package cnsukidayo.com.gitee.configuration;

import org.fisco.bcos.sdk.BcosSDK;
import org.fisco.bcos.sdk.client.Client;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;

import java.io.IOException;

/**
 * @author sukidayo
 * @date 2023/3/18 17:41
 */
@Configuration
public class THPetConfiguration {



    @Bean
    public BcosSDK bcosSDK() {
        ClassPathResource classPathResource = new ClassPathResource("config.toml");
        BcosSDK sdk = null;
        try {
            sdk = BcosSDK.build(classPathResource.getFile().getAbsolutePath());
        } catch (IOException e) {
            e.printStackTrace();
        }
        return sdk;
    }

    @Bean
    public Client client(BcosSDK bcosSDK){
        return bcosSDK.getClient(1);
    }

}
